<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增行政区划信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-xzqh-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">行政区划代码：</label>
                <div class="col-sm-8">
                    <input name="xzqhCode" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">行政区划名称：</label>
                <div class="col-sm-8">
                    <textarea name="xzqhName" class="form-control" required></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">父级行政区划代码：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="treeId" name="faXzqhCode" type="hidden" th:value="${xzqh?.xzqhCode}"/>
                        <input class="form-control" type="text" onclick="selectXzqhTree()" id="treeName" readonly="true" th:value="${xzqh?.xzqhName}" required>
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "xzqh/xzqh"
        $("#form-xzqh-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-xzqh-add').serialize());
            }
        }

        /*行政区划信息-新增-选择父行政区划信息树*/
        function selectXzqhTree() {
            var options = {
                title: '行政区划信息选择',
                width: "380",
                url: prefix + "/selectXzqhTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = $.modal.getChildFrame(index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            $.modal.close(index);
        }
    </script>
</body>
</html>